The gate forms in N4 support Groovy interception (a Groovy hook) at two levels:
Truck Visit
Gate Transaction
This topic covers the Groovy interception at the gate transaction level. You can use a GATE_UI_FIELD_INTERCEPTOR (on page 1) code extension to read data from N4 or perform calculations and automatically fill in certain fields in the gate forms.
To configure and use the new Groovy code extension from the gate forms:
Add a new code extension of type, GATE_UI_FIELD_INTERCEPTOR (on page 1).
In the code extension, override the following two methods of the AbstractGateFormFieldInterceptor class:
Map<MetafieldId, Object> execute(GateFormFieldExtensionContext inExtensionContext): The gate work flow invokes this method when a user enters data in a gate field.
Map<MetafieldId, Object> executeAction(GateFormFieldExtensionContext inExtensionContext): The gate work flow invokes this method when a user clicks the Custom Transaction Action button in the gate transaction panel in a gate form.
After N4 executes the code extension, the gate form fields are filled in based on the field values in the Map returned by these methods. If the Map is null/empty, then the code extension does not do anything.
From the Gate Configurations view, add the Custom Transaction Action button to the gate transaction type for the gate stage where you want to execute the code extension.
Sample Scenario using the Groovy code extension at the Gate Transaction Level
This scenario is for configuring the Custom Transaction Action button and the related code extension for a Receive Export (RE) gate transaction type.
Setup the gate configuration and the Groovy hook
The following sample configuration is based on a scenario where the GATE_UI_FIELD_INTERCEPTOR code extension is added for the Receive Export (RE) gate transaction type.
When a user tabs out of the Container Number field, N4 invokes the Groovy code extension and automatically fills in the following fields for the gate transaction:
Notes
BAT Number
Tran Flex String-02
When a user clicks the Custom Transaction Action button, N4 invokes the Groovy code extension and automatically fills in the following fields for the gate transaction:
Scale Weight
Notes
To configure and use the new Groovy code extension from the gate forms:
Add a new code extension of the type, GATE_UI_FIELD_INTERCEPTOR.
From the Gate Configurations view, add the Custom Transaction Action button to the Receive Export (RE) gate transaction type for the gate stage where you want to execute the code extension.
From the Operations Gate menu, open the gate form for the gate stage at which you added the button.
Select the Receive Export gate transaction type.
N4 displays the Custom Transaction Action button in the transaction panel.
Enter the Container Number for a pre-advised unit in the gate form.
Tab out of the Container Number field and notice that N4 invokes the Groovy code extension and populates the following fields:
Notes
BAT Number
Tran Flex String-02
Click Custom Transaction Action and notice that N4 invokes the Groovy code extension and populates the following fields:
Scale Weight
Notes
Fields supported by the GATE_UI_FIELD_INTERCEPTOR code extension type
A code extension based on the GATE_UI_FIELD_INTERCEPTOR code extension type can be used to intercept and customize the following gate transaction fields:
RoadField.TRAN_IMPORT_RELEASE_NBR (Import Release Nbr)
RoadField.TRAN_EQO_NBR (Booking Number)
RoadBizMetafield.TRAN_EQO_NBR_AND_GKEY (Booking/Order)
RoadField.TRAN_EQO_ITEM (Booking Item)
RoadField.TRAN_LINE_ID (Line Id)
RoadField.TRAN_CTR_OPERATOR (Container Operator)
RoadField.TRAN_CHS_OPERATOR (Chassis Operator)
RoadField.TRAN_CTR_TYPE_ID (Container Type)
RoadField.TRAN_CTR_NBR_ASSIGNED (Container Nbr Requested)
RoadField.TRAN_CTR_FREIGHT_KIND (Freight Kind)
RoadField.TRAN_CHS_NBR_ASSIGNED (Chassis Number Requested)
RoadField.TRAN_CTR_NBR (Container Nbr)
RoadField.TRAN_CTR_ACC_NBR (Container Accessory Number)
RoadField.TRAN_CHS_ACC_NBR (Chassis Accessory Number)
RoadField.TRAN_CHS_NBR (Chassis Number)
RoadField.TRAN_CARRIER_VISIT (Vessel Visit)
RoadField.TRAN_APPOINTMENT_NBR (Appointment Number)
RoadField.TRAN_BL (Cargo Bill Of Lading)
RoadField.TRAN_CARGO_SERVICE_ORDER (Cargo Delivery Order)
RoadField.TRAN_FLEX_STRING01
RoadField.TRAN_FLEX_STRING02